import request from '@/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/submit',
    method: 'post',
    data: row
  })
}

export const npCrf = (groupId, id) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/npCrf',
    method: 'get',
    params: {
      groupId,
      id
    }
  })
}

export const groupAcquisition = (groupId, id) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/groupAcquisition',
    method: 'get',
    params: {
      groupId,
      id
    }
  })
}

export const createByPhone = (row) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/createByPhone',
    method: 'post',
    data: row
  })
}

export const nmCreateByPhone = (groupId, trialId) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/nmCreateByPhone',
    method: 'post',
    params: {
      groupId,
      trialId
    }
  })
}

export const sendSmsCode = (phone) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/sendSmsCode',
    method: 'post',
    params: {
      phone
    }
  })
}

export const loginByPhone = (phone, smsCode) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/loginByPhone',
    method: 'post',
    params: {
      phone,
      smsCode
    }
  })
}

export const enrollmentStatistics = (trial) => {
  return request({
    url: '/blade-trial/trial/enrollmentStatistics',
    method: 'get',
    params: {
      trial
    }
  })
}

export const fallOff = (id, fallOffRemark, fallOffSign) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/fallOff',
    method: 'post',
    params: { id, fallOffRemark, fallOffSign }
  })
}

export const completed = (row) => {
  return request({
    url: '/blade-clinicalcase/clinicalCase/completed',
    method: 'post',
    // params: { id,completedSign }
    data: row
  })
}

export const putFileBase64 = (base64String) => {
  return request({
    url: '/blade-resource/oss/endpoint/put-file-base64',
    method: 'post',
    data: base64String
  })
}